﻿
@{
    ViewBag.Title = "订单支付结果";
   // Layout = "~/Areas/Web/Views/Shared/_OrderTopBar.cshtml";
}
<div class="w cl">
    @{
        var errorMsg = ViewBag.Error;
        var flag = !string.IsNullOrWhiteSpace(errorMsg) ? "fail" : "success";
        var redirectUrl = string.IsNullOrWhiteSpace(errorMsg) ? "/" : ("/order/pay?orderIds=" + ViewBag.OrderIds);
        var htmlPart = string.IsNullOrWhiteSpace(errorMsg) ? ("秒后自动跳至<a  href=\"/\" class=\"link_1\">首页</a>") : ("秒后自动跳至支付页面<a  href=\"/order/pay?orderIds=" + ViewBag.OrderIds+"\" class=\"link_1\">支付页面</a>");
        }
    <div class="tips-page pay-@flag-page">
        @if (string.IsNullOrWhiteSpace(errorMsg))
        {
            <h2>
                恭喜您，支付成功！
            </h2>
            <div class="error_child">您可以： <a href="/">继续购买</a>。</div>
        }
        else
        {
            <h2>
                抱歉，支付失败！请重新支付！
            </h2>
            <div class="error_child">您可以：<a href="/order/pay?orderIds=@(ViewBag.OrderIds)">重新支付</a></div>
        }
      
        <div id="ShowDiv"></div>
    </div>

</div>


<script>
    $(function () {
        $('.progress-').hide();
    })

    var secs = 5; //倒计时的秒数
    var URL ;
    function Load(url){
        URL =url;
        for(var i=secs;i>=0;i--)
        {
            window.setTimeout('doUpdate(' + i + ')', (secs-i) * 1000);
        }
    }
        
    function doUpdate(num)
    {
        document.getElementById("ShowDiv").innerHTML = '将在<strong><font color=red> '+num+' </font></strong>@Html.Raw(htmlPart)，请稍候...' ;
        if(num == 0) { window.location=URL;  }
    }
    $(function(){
        Load("@redirectUrl");
    })


</script>